package com.aiguigu.JVM;

public class AAA {
    public static void main(String[] args) {

    }
    public static int indexMid(int[] arr, int start, int end , int target){
        int mid = (start + end) / 2;
        mid = (start + end) % 2==0? mid : mid+1;
        if (arr[mid] >= target){
            return indexMid(arr, start, mid, target);
        }
        return end;
    }

    public static int[] aculate(int[] arr, int target){
        int[] res = new int[2];
        int start = 0;
        int end = arr.length-1;
        end = indexMid(arr, start, end, target);
        for (; start < end;){
            int temp = arr[start] + arr[end];
            if (temp == target){
                res[0] = start;
                res[1] = end;
                return res;
            }else {
                if (temp > target){
                    end--;
                }else {
                    start++;
                }
            }
        }
        return null;
    }
}
